package io.renren.modules.eightapp.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.modules.eightapp.dao.EiVillageInfoDao;
import io.renren.modules.eightapp.dto.EiVillageInfoDTO;
import io.renren.modules.eightapp.entity.EiVillageInfoEntity;
import io.renren.modules.eightapp.service.EiVillageInfoService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author Mark 1132115960@gmail.com
 * @since 1.0.0 2022-12-27
 */
@Service
public class EiVillageInfoServiceImpl extends CrudServiceImpl<EiVillageInfoDao, EiVillageInfoEntity, EiVillageInfoDTO> implements EiVillageInfoService {

//    @Autowired
//    BaseDao baseDao;
    @Autowired
   private EiVillageInfoDao eiVillageInfoDao;

    @Override
    public QueryWrapper<EiVillageInfoEntity> getWrapper(Map<String, Object> params) {
        String id = (String) params.get("id");

        QueryWrapper<EiVillageInfoEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StringUtils.isNotBlank(id), "id", id);

        return wrapper;
    }


    @Override
    public List<EiVillageInfoEntity> getAllEiVillage() {
        QueryWrapper<EiVillageInfoEntity> queryWrapper=new QueryWrapper<>();
        queryWrapper.lambda().select();
        List<EiVillageInfoEntity> list = eiVillageInfoDao.selectList(queryWrapper);
        return list;
    }
}